package netTrackerGUI;

import java.util.*;

/**
 * A utility class for mapping keys to the names of notes.
 * 
 * @author David Cummings
 */

@SuppressWarnings("serial")

public class KeyMapper {
	
	/**
	 * Create a map of Note Name, Frequency pairs.
	 */
	private static final HashMap<String, String> KEY_TO_NAME =
					new HashMap<String, String>(){
						{
							put("Z", "C-4");
							put("S", "C#4");
							put("X", "D-4");
							put("D", "D#4");
							put("C", "E-4");
							put("V", "F-4");
							put("G", "F#4");
							put("B", "G-4");
							put("H", "G#4");
							put("N", "A-4");
							put("J", "A#4");
							put("M", "B-4");
							put("Q", "C-5");
							put("2", "C#5");
							put("W", "D-5");
							put("3", "D#5");
							put("E", "E-5");
							put("R", "F-5");
							put("5", "F#5");
							put("T", "G-5");
							put("6", "G#5");
							put("Y", "A-5");
							put("7", "A#5");
							put("U", "B-5");
							put("Back Slash", "---");
							put("Delete", "");
						}
					};
	/**
	 * Maps a frequency to a string representation of the closest note.
	 * @param frequency the frequency to look up
	 * @return the string representation of the frequency
	 */
	public static String lookup(String key){
		return KEY_TO_NAME.get(key);
	}
}
